<?php header("content-type:text/html; charset=utf-8"); 
include_once 'conn.php';
if(!empty($_POST['post'])){
    $username = $_POST['username'];
    $email = $_POST['email'];
    $content = $_POST['content'];   
    
   $sql = "insert into reply ( id,username,email,contet) values ( null, '$username','$email','$content')";
   $result = $conn->query($sql);
  
   
     if($result === TRUE){
         echo "<script type'text/javascript'>alert('留言成功！');location.href='index.php'</script>";
     }  else {
         echo "<script type'text/javascript'>alert('留言失败！');location.href='index.php'</script>";    
     }
}

?>
<form action="" method="post">
    <table border="0" width="500">
        <tr>
            <td width="100" align="right">用户名：</td>
            <td><input type="text" name="username" value=""/></td>
        </tr>
        <tr>
            <td width="100" align="right">E-mail：</td>
            <td><input type="text" name="email" value=""/></td>
        </tr>
        <tr>
            <td width="100" align="right">留言内容：</td>
            <td><textarea name="content"></textarea></td>
        </tr>
        <tr>
            <td colspan="2" align="center"><input type="submit" name="post" value="留言"/></td>
        </tr>
</form>
